﻿using System;
using System.Collections.Generic;
using System.Text;
using jade.content.onto;
using jade.content.schema;
using log4net;

namespace Agents.ontology
{
    public class HashMasterOntology : Ontology
    {

        private static readonly ILog log = LogManager.GetLogger(typeof(HashMasterOntology));
        /**
         * the name of ontology
         **/
        public static String ONTOLOGY_NAME = "HashMasterOntology";

        /**
         * vocabulary
         **/
        public static String HASH_REQUEST = "HashRequest";
        public static String HASH_RESPONSE = "HashResponse";
        public static String HASH_METHOD = "HashMethod";
        public static String TEXT = "text";
        public static String SPENT_TIME = "spentTime";


        private static Ontology theInstance = new HashMasterOntology();

        public static Ontology getInstance()
        {
            return theInstance;
        }

        public HashMasterOntology()
            : base(ONTOLOGY_NAME, BasicOntology.getInstance())
        {
            try
            {
                add(new AgentActionSchema(HASH_REQUEST), java.lang.Class.forName("Agents.ontology." + HASH_REQUEST));
                add(new ConceptSchema(HASH_RESPONSE), java.lang.Class.forName("Agents.ontology." + HASH_RESPONSE));


                AgentActionSchema request = (AgentActionSchema)getSchema(HASH_REQUEST);
                request.add(HASH_METHOD, (PrimitiveSchema)getSchema(BasicOntology.STRING));
                request.add(TEXT, (PrimitiveSchema)getSchema(BasicOntology.STRING));
                request.setResult((ConceptSchema)getSchema(HASH_RESPONSE));

                ConceptSchema response = (ConceptSchema)getSchema(HASH_RESPONSE);
                response.add(HASH_METHOD, (PrimitiveSchema)getSchema(BasicOntology.STRING));
                response.add(TEXT, (PrimitiveSchema)getSchema(BasicOntology.STRING));
                response.add(SPENT_TIME, (PrimitiveSchema)getSchema(BasicOntology.INTEGER));

            }
            catch (Exception e)
            {                
                log.Error(e);
                throw e;
            }
        }

    }
}
